From 4daa2dbb6a5711886e54148ab019ff15f92231c7 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 14 Nov 2008 00:30:34 +0000 Subject: [PATCH] Don't use getParameter() inside substituteResultWithError(), since it will try to call dieUsage() again if the format parameter is invalid. This fixes the error message for invalid formats, which was broken. --- includes/api/ApiFormatBase.php | 7 +++++++ includes/api/ApiMain.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 834588a1ca..0c832aa368 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -69,6 +69,13 @@ abstract class ApiFormatBase extends ApiBase { return false; } + /** + * Get the internal format name + */ + public function getFormat() { + return $this->mFormat; + } + /** * Specify whether or not ampersands should be escaped to '&' when rendering. This * should only be set to true for the help message when rendered in the default (xmlfm) diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 35c14262c4..e94f173162 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -445,7 +445,7 @@ class ApiMain extends ApiBase { * tell the printer not to escape ampersands so that our links do * not break. */ $printer->setUnescapeAmps ( ( $this->mAction == 'help' || $isError ) - && $this->getParameter('format') == ApiMain::API_DEFAULT_FORMAT ); + && $printer->getFormat() == 'XML' && $printer->getIsHtml() ); $printer->initPrinter($isError); -- 2.20.1